/*
 * Copyright 2014 Graham Smith
 */
package uk.co.wobblycogs.vegas.scan;

import java.io.Serializable;
import java.nio.file.Path;
import java.nio.file.attribute.FileTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

/**
 *
 * @author Graham Smith
 */
@Entity
@NamedQueries({
	@NamedQuery(name = FileResource.FIND_ALL, query = "SELECT f FROM FileResource f"),
	@NamedQuery(name = FileResource.FIND_BY_PATH, query = "SELECT f FROM FileResource f WHERE f.resourcePath = :resourcePath")
})
public class FileResource implements Serializable {

	public static final String FIND_ALL = "uk.co.wobblycogs.vegas.scan.FileResource.findAll";
	public static final String FIND_BY_PATH = "uk.co.wobblycogs.vegas.scan.FileResource.findByPath";

	@Id
	@GeneratedValue
	private Long id;

	@Column(unique = true)
	private Path resourcePath;
	private FileTime lastModified;
	private Long fileSize;
	private String extension;

	public FileResource() {
	}

	public FileResource(Path resourcePath) {
		this.resourcePath = resourcePath;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Path getResourcePath() {
		return resourcePath;
	}

	public void setResourcePath(Path resourcePath) {
		this.resourcePath = resourcePath;
	}

	public FileTime getLastModified() {
		return lastModified;
	}

	public void setLastModified(FileTime lastModified) {
		this.lastModified = lastModified;
	}

	public Long getFileSize() {
		return fileSize;
	}

	public void setFileSize(Long fileSize) {
		this.fileSize = fileSize;
	}

	public String getExtension() {
		return extension;
	}

	public void setExtension(String extension) {
		this.extension = extension;
	}

}
